﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib" 
    xmlns:m="clr-namespace:Signum.Windows"
	xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:dn="clr-namespace:Signum.Entities;assembly=Signum.Entities" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	mc:Ignorable="d">

    <SolidColorBrush x:Key="BlueBorder" Color="#FF0046AD"/>
	
    <LinearGradientBrush x:Key="BlueBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFFFFFFF" Offset="0"/>
        <GradientStop Color="#FFC9E4FF" Offset="1"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="LightBlueBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFF7FBFF" Offset="0"/>
        <GradientStop Color="#FFD4E9FF" Offset="1"/>
    </LinearGradientBrush>

    <Path x:Key="Create" Stretch="Fill" Stroke="#FF117333" x:Shared="False">
        <Path.Data>
            <CombinedGeometry GeometryCombineMode="Union" >
                <CombinedGeometry.Geometry1>
                    <RectangleGeometry Rect="7,0,6,20"/>
                </CombinedGeometry.Geometry1>
                <CombinedGeometry.Geometry2>
                    <RectangleGeometry Rect="0,7,20,6"/>
                </CombinedGeometry.Geometry2>
            </CombinedGeometry>
        </Path.Data>
        <Path.Fill>
            <RadialGradientBrush SpreadMethod="Pad" GradientOrigin="0.446,0.456">
                <RadialGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="0.88" ScaleY="0.88"/>
                        <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                        <RotateTransform Angle="0" CenterX="0.5" CenterY="0.5"/>
                        <TranslateTransform X="-0.031" Y="-0.08"/>
                    </TransformGroup>
                </RadialGradientBrush.RelativeTransform>
                <GradientStop Color="#FF1BEC64" Offset="0"/>
                <GradientStop Color="#FF036625" Offset="1"/>
            </RadialGradientBrush>
        </Path.Fill>
    </Path>

    <Path x:Key="Find" Stretch="Fill" Stroke="#FFCCA802" RenderTransformOrigin="0.396,0.404" x:Shared="False">
        <Path.Data>
            <CombinedGeometry GeometryCombineMode="Union">
                <CombinedGeometry.Geometry1>
                    <CombinedGeometry GeometryCombineMode="Exclude">
                        <CombinedGeometry.Geometry1>
                            <EllipseGeometry RadiusX="7" RadiusY="7" Center="7,7"/>
                        </CombinedGeometry.Geometry1>
                        <CombinedGeometry.Geometry2>
                            <EllipseGeometry RadiusX="4" RadiusY="4" Center="7,7"/>
                        </CombinedGeometry.Geometry2>
                    </CombinedGeometry>
                </CombinedGeometry.Geometry1>
                <CombinedGeometry.Geometry2>
                    <RectangleGeometry Rect="10,8,10,4">
                        <RectangleGeometry.Transform>
                            <RotateTransform Angle="45" CenterX="10" CenterY="10"/>
                        </RectangleGeometry.Transform>
                    </RectangleGeometry>
                </CombinedGeometry.Geometry2>
            </CombinedGeometry>
        </Path.Data>
        <Path.Fill>
            <RadialGradientBrush SpreadMethod="Pad" GradientOrigin="0.446,0.456">
                <RadialGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.221" ScaleY="1.169"/>
                        <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                        <RotateTransform Angle="8.862" CenterX="0.5" CenterY="0.5"/>
                        <TranslateTransform X="-0.269" Y="-0.245"/>
                    </TransformGroup>
                </RadialGradientBrush.RelativeTransform>
                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                <GradientStop Color="#FFFFD303" Offset="0.788"/>
                <GradientStop Color="#FFFFFF00" Offset="0.319"/>
            </RadialGradientBrush>
        </Path.Fill>
    </Path>

    <Path x:Key="View" Stretch="Fill" Stroke="#FF032FCA" x:Shared="False">
        <Path.Data>
            <StreamGeometry>M20,10L9,18 10,13 0,13 0,7 10,7 9,2z</StreamGeometry>
        </Path.Data>
        <Path.Fill>
            <RadialGradientBrush SpreadMethod="Pad" GradientOrigin="0.425,0.499">
                <RadialGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.553" ScaleY="0.919"/>
                        <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                        <RotateTransform Angle="8.862" CenterX="0.5" CenterY="0.5"/>
                        <TranslateTransform X="-0.128" Y="-0.18"/>
                    </TransformGroup>
                </RadialGradientBrush.RelativeTransform>
                <GradientStop Color="#FF1BA0EC" Offset="0.424"/>
                <GradientStop Color="#FF0017B1" Offset="1"/>
            </RadialGradientBrush>
        </Path.Fill>
    </Path>


    <Path x:Key="Down" Stretch="Fill" Stroke="#FFCA03C4" x:Shared="False">
        <Path.Data>
            <StreamGeometry>M10,20L18,9 14,9 14,0 6,0 6,9 2,9z</StreamGeometry>
        </Path.Data>
        <Path.Fill>
            <RadialGradientBrush SpreadMethod="Pad" GradientOrigin="0.425,0.499">
                <RadialGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.553" ScaleY="0.919"/>
                        <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                        <RotateTransform Angle="8.862" CenterX="0.5" CenterY="0.5"/>
                        <TranslateTransform X="-0.128" Y="-0.18"/>
                    </TransformGroup>
                </RadialGradientBrush.RelativeTransform>
                <GradientStop Color="#FFE244D6" Offset="0.455"/>
                <GradientStop Color="#FFB100A3" Offset="1"/>
                <GradientStop Color="#FFE095DA" Offset="0.131"/>
            </RadialGradientBrush>
        </Path.Fill>
    </Path>

    <Path x:Key="Up" Stretch="Fill" Stroke="#FFCA03C4" x:Shared="False">
        <Path.Data>
            <StreamGeometry>M10,0L18,11 14,11 14,20 6,20 6,11 2,11z</StreamGeometry>
        </Path.Data>
        <Path.Fill>
            <RadialGradientBrush SpreadMethod="Pad" GradientOrigin="0.425,0.499">
                <RadialGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.553" ScaleY="0.919"/>
                        <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                        <RotateTransform Angle="8.862" CenterX="0.5" CenterY="0.5"/>
                        <TranslateTransform X="-0.128" Y="-0.18"/>
                    </TransformGroup>
                </RadialGradientBrush.RelativeTransform>
                <GradientStop Color="#FFE244D6" Offset="0.455"/>
                <GradientStop Color="#FFB100A3" Offset="1"/>
                <GradientStop Color="#FFE095DA" Offset="0.131"/>
            </RadialGradientBrush>
        </Path.Fill>
    </Path>

    <Path x:Key="Remove" Stretch="Fill" Stroke="#FFCA0803" x:Shared="False">
        <Path.Data>
            <CombinedGeometry GeometryCombineMode="Union">
                <CombinedGeometry.Geometry1>
                    <RectangleGeometry Rect="7,0,6,20"/>
                </CombinedGeometry.Geometry1>
                <CombinedGeometry.Geometry2>
                    <RectangleGeometry Rect="0,7,20,6"/>
                </CombinedGeometry.Geometry2>
                <CombinedGeometry.Transform>
                    <RotateTransform Angle="45" CenterX="10" CenterY="10"/>
                </CombinedGeometry.Transform>
            </CombinedGeometry>
        </Path.Data>
        <Path.Fill>
            <RadialGradientBrush SpreadMethod="Pad" GradientOrigin="0.425,0.499">
                <RadialGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.553" ScaleY="0.919"/>
                        <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                        <RotateTransform Angle="8.862" CenterX="0.5" CenterY="0.5"/>
                        <TranslateTransform X="-0.128" Y="-0.18"/>
                    </TransformGroup>
                </RadialGradientBrush.RelativeTransform>
                <GradientStop Color="#FFEE7C32" Offset="0.424"/>
                <GradientStop Color="#FFB10000" Offset="1"/>
            </RadialGradientBrush>
        </Path.Fill>
    </Path>

    <Style TargetType="{x:Type Button}" x:Key="RoundButton">
        <Setter Property="Width" Value="22"/>
        <Setter Property="Height" Value="22"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="Aparecer">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ShadowBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="desparecer">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ShadowBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="0.5"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Border BorderThickness="0,0,0,0" CornerRadius="100000,100000,100000,100000" Opacity="0" Margin="0,0,-1,-1" x:Name="ShadowBorder" Background="#39000000" RenderTransformOrigin="0.5,0.5">

                        </Border>
                        <Border x:Name="OuterBorder" BorderBrush="#FF6db6ff" BorderThickness="1,1,1,1" CornerRadius="100000,100000,100000,100000" Opacity="0">
                            <Border ClipToBounds="False" x:Name="InnerBorder" Width="Auto" Height="Auto" BorderBrush="#FFd4e9ff" BorderThickness="1,1,1,1" CornerRadius="10000,10000,10000,10000">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.505,0.489" StartPoint="0.512,-0.004">
                                        <GradientStop Color="#FFf7fbff" Offset="0"/>
                                        <GradientStop Color="#FFc9e4ff" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </Border>
                        <Viewbox Margin="{TemplateBinding Padding}" d:LayoutOverrides="GridBox" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                            <ContentPresenter x:Name="contentPresenter" Opacity="0.5" RenderTransformOrigin="0.5,0.5"/>
                        </Viewbox>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource desparecer}" x:Name="desparecer_BeginStoryboard"/>
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource Aparecer}" x:Name="Aparecer_BeginStoryboard"/>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Opacity" TargetName="contentPresenter" Value="1"/>
                            <Setter Property="Background" TargetName="InnerBorder">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.505,0.489" StartPoint="0.512,-0.004">
                                      <GradientStop Color="#FFc9e4ff" Offset="0"/>
                                      <GradientStop Color="#FFf7fbff" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="BorderBrush" TargetName="InnerBorder" Value="#FFaad5ff"/>
                            <Setter Property="BorderBrush" TargetName="OuterBorder" Value="#FFc0e0ff"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Padding" Value="3"/>
    </Style>

    <Style x:Key="toolTip" TargetType="FrameworkElement">
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                        Path=(Validation.Errors), Converter ={x:Static m:Converters.ErrorListToToolTipString}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <DataTemplate x:Key="{x:Type dn:ModifiableEntity}"  DataType="{x:Type dn:ModifiableEntity}">
        <Border
            ToolTip="{Binding Error, Converter = {x:Static m:Converters.CollapseStringEmpty}}"
            BorderThickness="{Binding Error, Converter = {x:Static m:Converters.ErrorToInt}}"
            BorderBrush="Red" >
            <TextBlock Text="{Binding ToStringProperty}" VerticalAlignment="Center" />
        </Border>
    </DataTemplate>

    <DataTemplate x:Key="{x:Type dn:Lite}"  DataType="{x:Type dn:Lite}">
        <TextBlock Text="{Binding}" VerticalAlignment="Center" />
    </DataTemplate>

    <Style x:Key="LinkButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <TextBlock x:Name="tb" Background="{x:Null}" 
					Cursor="Hand" TextDecorations="Underline" Text="{TemplateBinding Content}" TextTrimming="CharacterEllipsis"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true" >
                            <Setter Property="Cursor" Value="Hand" />
                            <Setter TargetName="tb" Property="Foreground" Value="Red"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false" >
                            <Setter TargetName="tb" Property="TextDecorations" Value="None"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ThinButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="border" Background="{x:Null}" BorderThickness="1">
                        <ContentPresenter VerticalAlignment="Center" RecognizesAccessKey="true" HorizontalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="border" Value="#FF0053A7"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true" >
                            <Setter Property="BorderBrush" TargetName="border" Value="#FF00C6FF"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RoundBigButton" TargetType="{x:Type ButtonBase}">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="Aparecer">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ShadowBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="desparecer">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ShadowBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="0.5"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Border BorderThickness="0,0,0,0" Opacity="0" Margin="0,0,-1,-1" x:Name="ShadowBorder" Background="#39000000" RenderTransformOrigin="0.5,0.5" CornerRadius="{TemplateBinding Padding, Converter={x:Static m:Converters.ThicknessToCornerRadius}}">

                        </Border>
                        <Border x:Name="OuterBorder" BorderBrush="#FF6db6ff" BorderThickness="1,1,1,1" CornerRadius="{TemplateBinding Padding, Converter={x:Static m:Converters.ThicknessToCornerRadius}}" Opacity="0">
                            <Border ClipToBounds="False" x:Name="InnerBorder" Width="Auto" Height="Auto" BorderBrush="#FFd4e9ff" BorderThickness="1,1,1,1" CornerRadius="{TemplateBinding Padding, Converter={x:Static m:Converters.ThicknessToCornerRadius}}">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.505,0.489" StartPoint="0.512,-0.004">
                                        <GradientStop Color="#FFf7fbff" Offset="0"/>
                                        <GradientStop Color="#FFc9e4ff" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </Border>
                        <ContentPresenter x:Name="contentPresenter" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource desparecer}" x:Name="desparecer_BeginStoryboard"/>
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource Aparecer}" x:Name="Aparecer_BeginStoryboard"/>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Opacity" TargetName="contentPresenter" Value="1"/>
                            <Setter Property="Background" TargetName="InnerBorder">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.505,0.489" StartPoint="0.512,-0.004">
                                      <GradientStop Color="#FFc9e4ff" Offset="0"/>
                                      <GradientStop Color="#FFf7fbff" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="BorderBrush" TargetName="InnerBorder" Value="#FFaad5ff"/>
                            <Setter Property="BorderBrush" TargetName="OuterBorder" Value="#FFc0e0ff"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Padding" Value="2,2,2,2"/>
    </Style>

    <Style x:Key="LineExpanderToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid SnapsToDevicePixels="False" Background="Transparent">
                        <Rectangle HorizontalAlignment="Stretch" x:Name="circle" VerticalAlignment="Stretch" Stroke="{TemplateBinding BorderBrush}">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                    <GradientStop Color="#ADFFFFFF" Offset="0"/>
                                    <GradientStop Color="#FFBFBFBF" Offset="0.5"/>
                                    <GradientStop Color="#64878787" Offset="1"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle HorizontalAlignment="Stretch" Margin="2,2,2,2" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Fill" TargetName="circle">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                        <GradientStop Color="#FFBFBFBF" Offset="0.5"/>
                                        <GradientStop Color="#FF878787" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
                            <Setter Property="Fill" TargetName="circle">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="#FFF0F8FE" Offset="0"/>
                                        <GradientStop Color="#FFE0F3FE" Offset="0.3"/>
                                        <GradientStop Color="#FF6FA7C5" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
                            <Setter Property="Fill" TargetName="circle">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="#FFDCF0FA" Offset="0"/>
                                        <GradientStop Color="#FFC5E6F7" Offset="0.2"/>
                                        <GradientStop Color="#FF5690D0" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="LineExpander" TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3">
                        <DockPanel>
                            <ToggleButton Foreground="{TemplateBinding Foreground}"
									Margin="1" 
									x:Name="HeaderSite"
                                    Style="{StaticResource LineExpanderToggleButton}"
									ContentTemplate="{TemplateBinding HeaderTemplate}" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
									DockPanel.Dock="Top" BorderBrush="#FF637E99">
                                <ToggleButton.FocusVisualStyle>
                                    <Style>
                                        <Setter Property="Control.Template">
                                            <Setter.Value>
                                                <ControlTemplate>
                                                    <Border>
                                                        <Rectangle SnapsToDevicePixels="true" Margin="0" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1"/>
                                                    </Border>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ToggleButton.FocusVisualStyle>
                            </ToggleButton>
                            <ContentPresenter Focusable="false" Visibility="Collapsed" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="ExpandSite" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" DockPanel.Dock="Bottom"/>
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                            <Setter Property="LayoutTransform" TargetName="HeaderSite">
                                <Setter.Value>
                                    <TransformGroup>
                                        <RotateTransform Angle="90"/>
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                            <Setter Property="LayoutTransform" TargetName="HeaderSite">
                                <Setter.Value>
                                    <TransformGroup>
                                        <RotateTransform Angle="90"/>
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GroupBoxExpanderToggleButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid Height="20">
                        <Border CornerRadius="9,9,9,9" BorderThickness="1,1,1,1" BorderBrush="{TemplateBinding BorderBrush}" x:Name="border">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                                    <GradientStop Color="#59000000" Offset="0"/>
                                    <GradientStop Color="#00FFFFFF" Offset="0.5"/>
                                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                        <Grid SnapsToDevicePixels="False" Background="Transparent" HorizontalAlignment="Right" Width="16" Height="16" VerticalAlignment="Center" Margin="0,0,2,0">
                            <Ellipse HorizontalAlignment="Center" x:Name="circle" VerticalAlignment="Center" Width="16" Height="16" Stroke="{TemplateBinding BorderBrush}"/>
                            <Path SnapsToDevicePixels="false" x:Name="arrow" VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" Data="M1,1 L4,4 7,1" />
                        </Grid>
                        <ContentPresenter HorizontalAlignment="Stretch" Content="{TemplateBinding Content}" VerticalAlignment="Center"/>

                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" TargetName="arrow" Value="M 1,4  L 4,1  L 7,4"/>
                            <Setter Property="Background" TargetName="border">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                                        <GradientStop Color="#59000000" Offset="1"/>
                                        <GradientStop Color="#00FFFFFF" Offset="0.5"/>
                                        <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF000000"/>
                            <Setter Property="Stroke" TargetName="arrow" Value="#FF000000"/>
                            <Setter Property="BorderBrush" TargetName="border" Value="#FF000000"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GroupBoxExpander" TargetType="Expander">
        <Setter Property="BorderBrush" Value="#D0D0BF" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,1" CornerRadius="9,9,9,9" Background="{TemplateBinding Background}">
                        <Grid SnapsToDevicePixels="true">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <ContentPresenter x:Name="ExpandSite" Grid.Row="1" Grid.Column="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" OpacityMask="#FFD41212" Grid.RowSpan="1" Visibility="Collapsed" Margin="1,1,1,1" />

                            <ToggleButton MinHeight="0" MinWidth="0"
                				x:Name="HeaderToggle" Style="{StaticResource GroupBoxExpanderToggleButtonStyle}"
                				IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Content="{TemplateBinding Header}" BorderBrush="{TemplateBinding BorderBrush}" Margin="-1,-1,-1,-1" />

                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <SolidColorBrush x:Key="LightBlue" Color="#FFC9E4FF"/>

    <Style x:Key="EntityGroupBox" TargetType="{x:Type GroupBox}">
        <Setter Property="BorderBrush" Value="#D5DFE5"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupBox}">
                    <Border BorderBrush="#FF8CACCC" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Grid.RowSpan="2" Grid.Row="0" >
                        <Border BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" BorderBrush="#FFC9E4FF" Background="{TemplateBinding Background}">
                            <Grid SnapsToDevicePixels="true">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Border x:Name="Header" Padding="1" Grid.Row="0" Background="{DynamicResource LightBlue}" CornerRadius="2,2,0,0">
                                    <ContentPresenter Margin="2,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True"/>
                                </Border>
                                <Border Grid.RowSpan="2" Grid.Row="1">
                                	<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                		Margin="{TemplateBinding Padding}"  />
                                </Border>
                            </Grid>
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}"
               BasedOn="{StaticResource {x:Type TextBox}}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Microsoft_Windows_Themes:ListBoxChrome x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" RenderMouseOver="{TemplateBinding IsMouseOver}">
                        <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Microsoft_Windows_Themes:ListBoxChrome>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter TargetName="Bd" Property="BorderThickness" Value="0" />
                            <Setter Property="Padding" Value="3" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                        Path=(Validation.Errors), Converter ={x:Static m:Converters.ErrorListToToolTipString}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Hyperlink}">
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="DarkSlateBlue" />
            </Trigger>
        </Style.Triggers>
        <Setter Property="Foreground" Value="SteelBlue" />
        <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" />
    </Style>

    <Style x:Key="GrayGroupBox" TargetType="{x:Type GroupBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupBox}">
                    <Border CornerRadius="3" BorderThickness="1" BorderBrush="#FFA2ABAB" Margin="0,0,0,0">
                        <StackPanel>
                            <Border BorderBrush="#FFA2ABAB" BorderThickness="0,0,0,1" CornerRadius="2,2,0,0">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFCED6DB" Offset="1"/>
                                        <GradientStop Color="#FFE9EAEA"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True"/>
                            </Border>
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}"  />
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="WidgetExpander" TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                        <DockPanel>
                            <ToggleButton x:Name="HeaderSite" Margin="1" MinHeight="0" MinWidth="0" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" DockPanel.Dock="Top" d:IsLocked="True">
                                <ToggleButton.Style>
                                    <Style TargetType="{x:Type ToggleButton}">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                    <Border Padding="{TemplateBinding Padding}">
                                                        <Grid SnapsToDevicePixels="False" Background="Transparent">
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="*"/>
                                                                <ColumnDefinition Width="19"/>
                                                            </Grid.ColumnDefinitions>
                                                            <ContentPresenter HorizontalAlignment="Left" Margin="4,0,0,0" VerticalAlignment="Center" SnapsToDevicePixels="True" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True"/>
                                                            <Path x:Name="arrow" Stroke="#FF666666" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" SnapsToDevicePixels="False" Data="M1,1.5L4.5,5 8,1.5"/>
                                                        </Grid>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsChecked" Value="True">
                                                            <Setter Property="Data" TargetName="arrow" Value="M1,4.5L4.5,1 8,4.5"/>
                                                        </Trigger>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF222222"/>
                                                        </Trigger>
                                                        <Trigger Property="IsPressed" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ToggleButton.Style>
                                <ToggleButton.FocusVisualStyle>
                                    <Style>
                                        <Setter Property="Control.Template">
                                            <Setter.Value>
                                                <ControlTemplate>
                                                    <Border>
                                                        <Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="0" SnapsToDevicePixels="True"/>
                                                    </Border>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ToggleButton.FocusVisualStyle>
                            </ToggleButton>
                            <ContentPresenter x:Name="ExpandSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="False" Visibility="Collapsed" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" DockPanel.Dock="Bottom"/>
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="True">
                            <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                            <Setter Property="Style" TargetName="HeaderSite">
                                <Setter.Value>
                                    <Style TargetType="{x:Type ToggleButton}">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                    <Border Padding="{TemplateBinding Padding}">
                                                        <Grid SnapsToDevicePixels="False" Background="Transparent">
                                                            <Grid.RowDefinitions>
                                                                <RowDefinition Height="*"/>
                                                                <RowDefinition Height="19"/>
                                                            </Grid.RowDefinitions>
                                                            <Grid>
                                                                <Grid.LayoutTransform>
                                                                    <TransformGroup>
                                                                        <RotateTransform Angle="-90"/>
                                                                    </TransformGroup>
                                                                </Grid.LayoutTransform>
                                                                <Path x:Name="arrow" Stroke="#FF666666" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="False" Data="M1,1.5L4.5,5 8,1.5"/>
                                                            </Grid>
                                                            <ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" VerticalAlignment="Top" SnapsToDevicePixels="True" Grid.Row="1" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True"/>
                                                        </Grid>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsChecked" Value="True">
                                                            <Setter Property="Data" TargetName="arrow" Value="M1,4.5L4.5,1 8,4.5"/>
                                                        </Trigger>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF222222"/>
                                                        </Trigger>
                                                        <Trigger Property="IsPressed" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                            <Setter Property="Style" TargetName="HeaderSite">
                                <Setter.Value>
                                    <Style TargetType="{x:Type ToggleButton}">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                    <Border Padding="{TemplateBinding Padding}">
                                                        <Grid SnapsToDevicePixels="False" Background="Transparent">
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="*"/>
                                                                <ColumnDefinition Width="19"/>
                                                            </Grid.ColumnDefinitions>
                                                            <Grid>
                                                                <Grid.LayoutTransform>
                                                                    <TransformGroup>
                                                                        <RotateTransform Angle="180"/>
                                                                    </TransformGroup>
                                                                </Grid.LayoutTransform>
                                                                <ContentPresenter HorizontalAlignment="Left" Margin="4,0,0,0" VerticalAlignment="Center" SnapsToDevicePixels="True" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True"/>
                                                                <Path x:Name="arrow" Stroke="#FF666666" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" SnapsToDevicePixels="False" Data="M1,1.5L4.5,5 8,1.5"/>
                                                            </Grid>
                                                        </Grid>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsChecked" Value="True">
                                                            <Setter Property="Data" TargetName="arrow" Value="M1,4.5L4.5,1 8,4.5"/>
                                                        </Trigger>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF222222"/>
                                                        </Trigger>
                                                        <Trigger Property="IsPressed" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                            <Setter Property="Style" TargetName="HeaderSite">
                                <Setter.Value>
                                    <Style TargetType="{x:Type ToggleButton}">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                    <Border Padding="{TemplateBinding Padding}">
                                                        <Grid SnapsToDevicePixels="False" Background="Transparent">
                                                            <Grid.RowDefinitions>
                                                                <RowDefinition Height="*"/>
                                                                <RowDefinition Height="19"/>
                                                            </Grid.RowDefinitions>
                                                            <Grid>
                                                                <Grid.LayoutTransform>
                                                                    <TransformGroup>
                                                                        <RotateTransform Angle="90"/>
                                                                    </TransformGroup>
                                                                </Grid.LayoutTransform>
                                                                <Path x:Name="arrow" Stroke="#FF666666" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="False" Data="M1,1.5L4.5,5 8,1.5"/>
                                                            </Grid>
                                                            <ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" VerticalAlignment="Top" SnapsToDevicePixels="True" Grid.Row="1" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True"/>
                                                        </Grid>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsChecked" Value="True">
                                                            <Setter Property="Data" TargetName="arrow" Value="M1,4.5L4.5,1 8,4.5"/>
                                                        </Trigger>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF222222"/>
                                                        </Trigger>
                                                        <Trigger Property="IsPressed" Value="True">
                                                            <Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>